home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Light ROM 1
/
LIGHT-ROM 1 (Amiga Library Services)(1994).iso
/
ffdisks
/
d916.lha
/
ScreenMode
/
Auto.doc
next >
Wrap
Text File
|
1993-10-04
|
7KB
|
194 lines
====================== ScreenModeRequester =====================
-------------------------------------------------------------------------------
NAME
UserScreenMode -- Open a ScreenModeRequester to ask the user about the
ModeID, size, depth and overscan-info for the screen
you are about to open.
SYNOPSIS
extern int __asm UserScreenMode( register __a1 UBYTE * PublicScreenName,
register __a2 SCRMODE * DataToFill,
register __a3 PRPT ** PropList );
ok = UserScreenMode( PublicScreenName, DataToFill, PropList )
d0 a1 a2 a3
FUNCTION
This function opens a requester and shows all possible ModeID's in several
(changeable) lists. The programmer can include or exclude the properties he
wants to support. The user can select one of these modes, change the width,
height and depth and the displaysize (overscan).
INPUTS
PublicScreenName
A pointer to the name of the PUBLIC screen you want the requester to
appear on. A NULL pointer will open the requester on the default public
screen.
DataToFill
A pointer to a "SCRMODE" structure (see "UserScreenMode.h"). If
"UserScreenMode()" returns TRUE (1) you can use the variables in this
structure to open a screen.
Otherwise the structure won't have been changed.
PropList
A pointer to an array of _pointers_ to "PRPT" structures (see
"UserScreenMode.h"), ending with a NULL pointer. They will be used for
the properties gadget. With this list you can include or exclude any
mode with a certain property in the listview gadget; t.i. the
selectable display modes. See the example below.
RESULT
A TRUE (1) result may be expected when the user made a choise. All other
situations (including errors) will result in a FALSE (0).
Errors can be found in the "USM_Error" variable. See the example below.
NOTE
The library-pointers IntuitionBase, GFXBase and GadToolsBase should be
defined in your code, but you don't have to open these libraries if your
code doesn't need them.
COPYRIGHT
(c) ASWare 1993, by Ekke Verheul. This function is FREEWARE, you may link it
with your own source without letting me know - as long as you don't change
anything in the object (like the copyright). If you need to make changes or
if you want to use this object for a commercial product REGISTER FIRST!
If you register you will receive the latest versions of all my PD-stuff,
including the full source of "UserScreenMode". Read the ReadMe file!
EXAMPLE
#include <exec/types.h>
#include <intuition/intuition.h>
#include <clib/exec_protos.h>
#include <clib/dos_protos.h>
#include <clib/intuition_protos.h>
#include <stdio.h>
#define USM_ERRTXT //--- define this BEFORE ...
//--- .. #include "UserScreenMode.h",
//--- if you want to use USM_ERROR.
#include "UserScreenMode.h"
struct GfxBase *GfxBase; //---> Those must be defined,
struct IntuitionBase *IntuitionBase; //---> not necessaryly opened.
struct Library *GadToolsBase; //---> -*-
PRPT proplist[] =
{ //--- name[16], include, exclude. (see graphics/displayinfo.h)
//----------------------------------------------------------------------------
{ "ALL", DIPF_ALL, DIPF_NONE },
{ "PAL ONLY", DIPF_IS_PAL, DIPF_NONE },
{ "WORKBENCH", DIPF_IS_WB, DIPF_NONE },
{ "LACE", DIPF_IS_LACE, DIPF_NONE },
{ "HAM/NOLACE", DIPF_IS_HAM, DIPF_IS_LACE },
{ "NO HAM/EHB", DIPF_ALL, DIPF_IS_HAM|DIPF_IS_EXTRAHALFBRITE },
{ "ECS/AA", DIPF_IS_ECS|DIPF_IS_AA, DIPF_NONE },
{ "FOREIGN", DIPF_IS_FOREIGN, DIPF_NONE },
};
PRPT *plist[] = //---> this list must be passed!
{
&proplist[0],
&proplist[1],
&proplist[2],
&proplist[3],
&proplist[4],
&proplist[5],
&proplist[6],
&proplist[7],
NULL //---> end with a NULL pointer!
};
void main(int argc,char **argv)
{
struct Screen *scr;
SCRMODE scrmode;
UBYTE name[32];
if (IntuitionBase = OpenLibrary("intuition.library",36))
{
if (UserScreenMode(NULL,&scrmode,plist))
{
if (scr = OpenScreenTags (NULL,
SA_Width, scrmode.Width,
SA_Height, scrmode.Height,
SA_Depth, scrmode.Depth,
SA_DisplayID, scrmode.ModeID,
SA_Overscan, scrmode.OScan,
SA_FullPalette, TRUE,
SA_SysFont, 1L,
SA_Type, PUBLICSCREEN,
SA_AutoScroll, TRUE,
SA_PubName, "TestScreen",
TAG_END))
{
Delay(300);
CloseScreen(scr);
if (ModeName(scrmode.ModeID,name))
{ printf("You've selected a \"%s\" screen\n",name);
}
}
}
else if (USM_Error) printf("ERROR: %s\n",USM_ERROR);
CloseLibrary(IntuitionBase);
}
}
-------------------------------------------------------------------------------
NAME
ModeName -- Ask the name of a mode.
SYNOPSIS
extern int __asm ModeName( register __d0 ULONG ModeID,
register __a0 UBYTE *Name );
ok = ModeName( ModeID, Name )
d0 d0 a0
FUNCTION
This function places the name of the mode in the "Name" buffer.
INPUTS
ModeID
The ModeID you want to know the name of.
Name
A pointer to at least 32 bytes of memory. This is where the
name will be if ModeName() returns TRUE.
RESULT
A TRUE (1) result may be expected if the function found a name for
this mode. If not, the result will be FALSE (0) and the "Name" buffer
will not have been changed.
NOTE
This fuction uses its own database for the known modes 'till WB3.0;
only unknown modes will be looked for in the Graphics-database.
The reason for this is SPEED; no one likes to wait forever..., besides,
the graphics-database doesn't know all names; HAM and EHB modes have to
do without and it takes even more time to create those from names of
other modes.
The object uses some memory, though. You will understand.
NOTE!
The fact that this function knows the name of a mode does NOT mean
that the system supports this mode! Always check the availabillity
with "if (DisplayInfo.NotAvailable == 0)".